package parse

func ParsePageInfo(
	current *uint64,
	size *int64,
	defaultSize int64,
	maxSize int64,
) (uint64, uint64) {
	var page uint64 = 1
	var pageSize int64
	if current != nil && *current > 1 {
		page = *current
	}

	if size != nil {
		// 0或-1表示查询全部
		if *size > 0 {
			pageSize = *size
			if pageSize > maxSize {
				pageSize = maxSize
			}
		}
	} else {
		pageSize = defaultSize
	}

	return page, uint64(pageSize)
}